﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Model.Interfaces;
using ViewModel.Interfaces;

namespace ViewModel
{
    public class ProjectsViewModel : ViewModelBase, IProjectsViewModel
    {
        public ProjectsViewModel(IViewModelObjectFactory factory, IProjectRepository repository)
        {
            _factory = factory;
            _ChreateChildCommand = _factory.CreateCommand(CanExecute, CreateChildView);
            _repository = repository;
        }

        private IViewModelObjectFactory _factory;
        private IAddProjectViewModel _AddProjectVM;
        private ICommand _ChreateChildCommand;
        private IProjectRepository _repository;

        public IAddProjectViewModel AddProjectVM
        {
            get { return _AddProjectVM; }
            private set { _AddProjectVM = value; }
        }

        public ICommand ChreateChildCommand
        {
            get { return _ChreateChildCommand; }
        }

        public bool CanExecute()
        { return true; }

        public void CreateChildView()
        {
            AddProjectVM = _factory.CreateAddProjectViewModel();
        }
    }
}
